package com.dtkavin.controller;

import com.dtkavin.pojo.User;
import com.dtkavin.service.IUserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by zhangzhiyong on 2016/9/20.
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Resource
    private IUserService userService;

    @RequestMapping("showUser")
    public String getUserById(HttpServletRequest request, Model model) {
        User user = userService.getUserById(Integer.parseInt(request.getParameter("id")));
        model.addAttribute("user", user);
        return "showUser";
    }
}
